package com.winit.schedule.job.tracker.repository.mysql.plugin;

public class SearchRequest<T> {

    private int pageNo;

    private int offset;

    private int pageSize;

    private T   parameterEntity;

    public SearchRequest(int pageNo, int pageSize){
        this.pageNo = pageNo < 1 ? 1 : pageNo;
        this.pageSize = pageSize == 0 ? Integer.MAX_VALUE : pageSize;
        this.offset = (this.pageNo - 1) * this.pageSize;
    }

    public int getOffset() {
        return offset;
    }

    public void setOffset(int offset) {
        this.offset = offset;
    }

    public int getPageSize() {
        return pageSize;
    }

    public void setPageSize(int pageSize) {
        this.pageSize = pageSize;
    }

    public T getParameterEntity() {
        return parameterEntity;
    }

    public void setParameterEntity(T parameterEntity) {
        this.parameterEntity = parameterEntity;
    }

    public int getPageNo() {
        return pageNo;
    }

    public void setPageNo(int pageNo) {
        this.pageNo = pageNo;
    }

}
